#coding:utf8
import tkinter as tk
from interface.two_one import To_words
from tkinter import Toplevel
from interface.two_two import Classifier
from interface.two_three import UseClassifier
from interface.two_four import Chart
from interface.two_pa import Pa


class Application(tk.Frame):

    def __init__(self, master=None):
        tk.Frame.__init__(self, master)
        self.grid()
        self.createWidgets()
    
    def createWidgets(self):
        self.btpa = tk.Button(self,text="爬虫爬取手机评论信息",width="29",height="2",command=self.data)
        self.btpa.grid(row=0,columnspan=2)
        self.btone = tk.Button(self,text="分词",width="14",height="4",command=self.fenci)
        self.btone.grid(row=1,column=0,sticky=tk.W+tk.S)
        self.bttwo = tk.Button(self,text="训练分类器",width="14",height="4",command=self.classifier1)
        self.bttwo.grid(row=1,column=1,sticky=tk.E+tk.S)
        self.btthree = tk.Button(self,text="情感分析",width="14",height="4",command=self.classifier2)
        self.btthree.grid(row=2,column=0,sticky=tk.W+tk.N)
        self.btfour = tk.Button(self,text="生成图表",width="14",height="4",command=self.rs)
        self.btfour.grid(row=2,column=1,sticky=tk.E+tk.N)
    def data(self):
        tl = Toplevel()
        tl.resizable(0,0)
        tl.wm_attributes("-topmost", 1)
        Pa(tl)    
    def fenci(self):
        tl = Toplevel()
        tl.resizable(0,0)
        tl.wm_attributes("-topmost", 1)
        To_words(tl)
    def classifier1(self):
        tl = Toplevel()
        tl.resizable(0,0)
        tl.wm_attributes("-topmost", 1)
        Classifier(tl)
    def classifier2(self):
        tl = Toplevel()
        tl.resizable(0,0)
        tl.wm_attributes("-topmost", 1)
        UseClassifier(tl)
    def rs(self):
        tl = Toplevel()
        tl.resizable(0,0)
        tl.wm_attributes("-topmost", 1)
        Chart(tl)
root = tk.Tk()
root.title("手机评论分析系统")
root.resizable(0, 0)
app = Application(master=root)
app.mainloop()       